import { ref } from "vue";
import { useEventListener } from "./useEventListener.js";

// 抽离一个 useMouse 的组合式函数
export function useMouse() {
  const x = ref(0);
  const y = ref(0);

  function update(event) {
    console.log("11111");
    x.value = event.clientX;
    y.value = event.clientY;
  }

  useEventListener(window, "click", update);

  return {
    x,
    y,
  };
}
